home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
DDJMAG
/
DDJ9310.ZIP
/
1993-OCT.ZIP
/
68HC11.ASC
next >
Wrap
Text File
|
1993-09-17
|
1KB
|
41 lines
_AVOIDING MICROCONTROLLER PROCESSING PILEUPS_
by Eric McRae
[LISTING ONE]
/* 6 KHZ interrupt handler. Called from timer ISR. Makes use of INTSOFF
** and INTSON macros which disable and enable interrupts. */
void
sixkhz()
(
int hit, i;
do6kdft(); /* Handle voice DFT processing */
hit = -1; /* Assume no counter hits zero */
for( i = 0; i < MAXCTRS; i++ ) /* Decrement each Counter */
(
if( ! counter[i]-- )
( /* if this counter hit 0 */
if( hit != -1 ) /* If another counter already expired */
{ /* Oh No! Processing Pile */
}
else hit = i; /* Else save index of ctr hitting 0 */
)
) /* end of for each counter */
if( hit != -1 )
( /* If a counter did hit zero */
INTSOFF; /* Disable Interrupts */
if(busyN++) /* If already running a handler */
{ /* Overrun Error if get here (Busy was already set)*/
)
INTSON; /* Enable interrupts */
(do_handler[i])(); /* invoke processing handler */
INTSOFF; /* Disable interrupts */
counter[i] += resetval[i] ) /* Reload ctr considering */
/* time already used */
busyN = 0; /* clear busy flag */
INTSON; /* enable interrupts */
) /* End of it counter expired */
)